package com.designpattern.ProxyPattern;

/**
 * @Author yp
 * @Date 2021-05-25
 * @Description 静态代理
 **/

public class ProxyExampleStatic {
    public static void main(String[] args) {
        BuyHouse buyHouse = new BuyHouseImpl();
        buyHouse.buyHosue();
        System.out.println("**********************************  添加代理之后");
        BuyHouseProxy buyHouseProxy = new BuyHouseProxy(buyHouse);
        buyHouseProxy.buyHosue();
    }
}

class BuyHouseProxy implements BuyHouse{

    private BuyHouse buyHouse;

    public BuyHouseProxy(final BuyHouse buyHouse){
        this.buyHouse = buyHouse;
    }
    @Override
    public void buyHosue() {
        System.out.println("代理操作：买房前准备");
         buyHouse.buyHosue();
         System.out.println("代理操作：买房后装修");
    }
}
